package com.zqxq.lottery.service.jczq.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.zqxq.lottery.entity.po.jczq.JczqMatchPO;
import com.zqxq.lottery.entity.vo.jczq.JczqMatchLiveVO;
import com.zqxq.lottery.entity.vo.sys.SysMatchVO;
import com.zqxq.lottery.mapper.sys.MatchManagementMapper;
import com.zqxq.lottery.service.jczq.IMatchManagementService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author 苦智
 * @date 2018/5/7 13:45
 * @description
 * @ClassName MatchManagementServiceImpl
 */
@Service
public class MatchManagementServiceImpl extends ServiceImpl<MatchManagementMapper,JczqMatchPO> implements IMatchManagementService {

    @Override
    public List<Map<String, Object>> getAllLeague() {
        return baseMapper.queryLeagueList();
    }

    public List<SysMatchVO> selectMatchList(Long leagueId,Integer isHot,String matchTime,String league){

        return baseMapper.selectMatchList(leagueId,isHot,matchTime,league);

    }

    public Map<String,Object> selectMatchResultList(Integer pageNo,Integer pageSize, Long id,Long leagueId, Integer status, String matchTime, String league){
        Map<String,Object> map = new HashMap<>();
        Page page1 = new Page(pageNo, pageSize);
        List<JczqMatchLiveVO> shouldList = baseMapper.selectMatchShouldList(page1,matchTime);
        page1.setRecords(shouldList);
        Page page2 = new Page(pageNo, pageSize);
        List<JczqMatchLiveVO> noResultList = baseMapper.selectNoResultListList(page2,matchTime);
        page2.setRecords(noResultList);
        map.put("shouldCount",page1.getTotal());
        map.put("noResultCount",page2.getTotal());
        map.put("shouldList",page1);
        map.put("noResultList",page2);
        return map;
    }

    @Override
    public Integer getManualCount() {
        return baseMapper.getManualCount();
    }

    @Override
    public Integer updateMatchHotStatus(Long id,Integer isHot) {
        return baseMapper.updateMatchHotStatus(id,isHot);
    }
}
